module sdldee.video.colour;

import sdldee.c.sdl;

class Colour {
	private SDL_Color* _colour;
	
	this(SDL_Color* colour) {
		_colour = colour;
	}
	
	this(ubyte r, ubyte g, ubyte b) {
		_colour = new SDL_Color();
		_colour.r = r;
		_colour.g = g;
		_colour.b = b;
	}
	
	public SDL_Color* ccolour() {
		return _colour;
	}
	
	public ubyte r() {
		return _colour.r;
	}
	
	public void r(ubyte value) {
		_colour.r = value;
	}
	
	public ubyte g() {
		return _colour.g;
	}
	
	public void g(ubyte value) {
		_colour.g = value;
	}
	
	public ubyte b() {
		return _colour.b;
	}
	
	public void b(ubyte value) {
		_colour.b = value;
	}
	
	public static SDL_Color* colourArrayToCArray(Colour[] colours) {
		SDL_Color[] sdlcolours;
		sdlcolours.length = colours.length;
		for(int i = 0; i < colours.length; i++)
			sdlcolours[i] = *colours[i].ccolour;
		
		return sdlcolours.ptr;
	}
}
